#pragma once
#include "afxcmn.h"
#include "DlgTrailBOMDetail.h"
#include "afxwin.h"



// CBugetTrailWnd form view

class CBugetTrailWnd : public CFormView
{
	DECLARE_DYNCREATE(CBugetTrailWnd)

public:
	enum { IDD = IDD_BUGETTRAILWND };
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif

public:
	CBugetTrailWnd();           // protected constructor used by dynamic creation
	virtual void OnInitialUpdate();

public:
	afx_msg void OnTvnSelchangedTreeTrailBomMaterail(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTcnSelchangeTabTrailBomDetail(NMHDR *pNMHDR, LRESULT *pResult);

protected:
	virtual ~CBugetTrailWnd();

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	DECLARE_MESSAGE_MAP()

private:

	CTreeCtrl m_treeMaterials;
	CTabCtrl m_tabTrailBomDetails;	
	CDlgTrailBOMDetail m_dlgBOMDetail;
	CComboBox m_cbxCustomerSelector;
	
	BOOL InitControls();
	BOOL InitControlStyle();
	BOOL InitTreeCtrl();
	BOOL InitListCtrl();
	BOOL InitTabCtrl();

	int BindingTreeCtrl(  HTREEITEM ptiRoot, const CString& strMaterialKey = _T("") );
	int BindingCombox();

	CString RecursionDeleteSbuItems( HTREEITEM hItemSelected);

public:
	afx_msg void OnCbnSelchangeCbxTrailCustomerSelector();
};


